package com.lzp.androidprojects.simple1.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.lzp.androidprojects.simple1.presenter.BasePresenter;
import com.lzp.androidprojects.simple1.view.MvpView;


/**
 * Created by Administrator on 2019/6/1.
 */
public abstract class BaseActivity<V extends MvpView,T extends BasePresenter<V>> extends AppCompatActivity{
    protected T basePresenter;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        basePresenter = getBasePresenter();
        basePresenter.attach((V) this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        basePresenter.deAttach();
    }

    public abstract T getBasePresenter();
}
